import request from '@/utils/request'

const api = {
    moduleapi: '/system/person'
}

export function getList(parameter)
{
    return request({
        url: api.moduleapi + '/list',
        method: 'get',
        params: parameter
    })
}


export function getListByPersonUnids(params)
{
    return request({
        url: api.moduleapi + '/getListByPersonUnids',
        method: 'get',
        params: params
    })
}

export function getAllPersonList(parameter)
{
    return request({
        url: api.moduleapi + '/getAllPersonByOrgunid',
        method: 'get',
        params: parameter
    })
}
// export function getList(parameter){
//   return request({
//     url: '/system/org/getPersons',
//     method: 'post',
//     data: parameter,
//     headers: {
//       'Content-Type': 'application/json;charset=UTF-8'
//     }
//   })
// }

export function getInfo(unid)
{
    return request({
        url: api.moduleapi + '/' + unid,
        method: 'get',
        noShowError: true,
    })
}


export function saveInfo(parameter)
{
    return request({
        url: api.moduleapi + '/rysh',
        method: 'post',
        data: parameter,
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}

export function getPersonNum()
{
    return request({
        url: api.moduleapi + '/getPersonNum',
        method: 'get'
    })
}

// export function resetPwd(parameter)
// {
//     return request({
//         url: '/resetPwd',
//         method: 'post',
//         params: parameter,
//         // data: parameter,
//         headers: {
//             'Content-Type': 'application/json;charset=UTF-8'
//         }
//     })
// }

export function resetPwdBySuperAdmin(parameter)
{
    return request({
        url: '/resetPwdBySuperAdmin',
        method: 'post',
        params: parameter,
        // data: parameter,
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}


export function resetPwd(data)
{
    return request({
        url: api.moduleapi + '/resetPwd',
        method: 'post',
        data,
    })
}

export function savePerson(parameter)
{
    return request({
        url: '/system/person/save',
        method: 'post',
        data: parameter,
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}

export function updatePerson(parameter)
{
    return request({
        url: api.moduleapi,
        method: 'put',
        data: parameter,
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}

export function delPerson(params)
{
    return request({
        url: api.moduleapi + '/delete',
        method: 'delete',
        params: params
    })
}

export function getFlowPerson(params)
{
    return request({
        url: '/flow/func/flowPerson',
        method: 'get',
        params: params
    })
}

export function flowOrg(params)
{
    return request({
        url: '/flow/func/flowOrg',
        method: 'get',
        params: params
    })
}

export function getOrgListByParentId(params)
{
    return request({
        url: '/flow/func/getOrgListByParentId',
        method: 'get',
        params: params
    })
}

export function getSelectAllTx(params)
{
    return request({
        url: 'txgl/selectAllTx',
        method: 'get',
        params: params
    })
}

export function getTxByUserId(params)
{
    return request({
        url: '/txgl/userId',
        method: 'get',
        params: params
    })
}

export function saveUserTx(params)
{
    return request({
        url: '/txgl/saveUserTx',
        method: 'post',
        data: params,
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}

// 检验用户阅文意见密码
export function checkNotionPass(params)
{
    return request({
        url: api.moduleapi + '/checkNotionPass',
        method: 'post',
        params,
    })
}

//批量添加角色
export function addRoles(data)
{
    return request({
        url: api.moduleapi + '/addRoles',
        method: 'post',
        data
    })
}

//批量设置部门
export function setOrg(data)
{
    return request({
        url: api.moduleapi + '/setOrg',
        method: 'post',
        data
    })
}

export function getCheckResult(params)
{
    return request({
        url: api.moduleapi + '/getCheckResult',
        method: 'get',
        params
    })
}

export function getPerosnMaxXh()
{
    return request({
        url: api.moduleapi + '/getPerosnMaxXh',
        method: 'get',
    })
}


//导出机构
export function exportPerson(data)
{
    return request({
        url:api.moduleapi + "/exportPerson",
        method:"post",
        data,
        responseType: 'blob'
    })
}

//解锁
export function unlock(params)
{
    return request({
        url:api.moduleapi + "/unlock",
        method:"post",
        params
    })
}

export const qbglExport = api.qbgl + '/export'